#include <avr/io.h>
#include <stdlib.h>
#include <avr/interrupt.h>

uint16_t pressureChamberTemperature = 0;
uint16_t vacuumChamberTemperature = 0;
uint16_t pressureChamberPressure = 0;
uint16_t vacuumChamberPressure = 0;
uint16_t resistanceWireVoltagePressureChamber = 0;
uint16_t resistanceWireVoltageVacuumChamber = 0;
uint16_t battery1Voltage = 0;
uint16_t battery2Voltage = 0;

int main(void)
{
	//Configure the ADC
	ADCSRA |=1 <<ADPS2;						//Enable a prescaler(ADC is slow)-determined by internal clock
	ADMUX |=1 <<REFS0;						//Set reference voltage
	
	//10-bit results and using ADLAR=0 right adjusted (by default)
	
	ADCSRA |=1 <<ADIE;						//Enable interrupts function in ADC
	ADCSRA |=1 <<ADEN;						//turn on the ADC feature (page 263 datasheet)
	sei();									//Enable the global interrupts
	ADCSRA |=1 <<ADSC;						//start the first conversion
	
	
	while (1)
	{}
}
//*********Add the interrupt routine and display results
ISR(ADC_vect)
{
	char theLow = ADCL;						//create 8-bit value for ADCL
	uint16_t tenBitvalue = ADCH<<8 | theLow;//get 10-bit res into a 16-bit number
	//select a location to display the number
	ADCSRA |=1 <<ADSC;						//Start the next conversion
}
//************